/**
 * Copyright 2013 Viettel Telecom. All rights reserved.
 * VIETTEL PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.viettel.junit4;

import java.util.ArrayList;
import java.util.List;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.viettel.core.common.utils.KPaging;
import com.viettel.core.dao.report.ReportUserDAO;
import com.viettel.core.dao.service.MTCSKHDAO;
import com.viettel.core.dao.service.SmsShortCodeDAO;
import com.viettel.core.entities.report.ReportUserTextDaily;
import com.viettel.core.entities.report.vo.ReportUserFilter;
import com.viettel.core.entities.report.vo.ReportUserVO;
import com.viettel.core.entities.service.MTCSKH;
import com.viettel.core.entities.service.SmsShortCode;

//import com.viettel.core.dao.UsersDAO;

/**
 *  Mo ta muc dich cua lop (interface)
 *  @author: ToanTM1
 *  @version: 1.0
 *  @since: 1.0
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "/spring/applicationContext.xml" })
public class AllTest {


	
	@Autowired
	MTCSKHDAO mTCSKHDAO;
	@Autowired
	SmsShortCodeDAO smsShortCodeDAO;
	
	@Autowired
	ReportUserDAO reportUserDAO;
	
	
	@Test
	public void getMTBySession() {		
		try {		
			List<MTCSKH> lst=mTCSKHDAO.getMTCSKHBySessionId("6b94d609-ad6e-4a4a-a0a2-863c45453f63");
			for (MTCSKH mtcskh : lst) {
				System.out.println(mtcskh.getContent());
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}	
	
	@Test
	public void getListsmsShortCode() {		
		try {		
			List<SmsShortCode> lst=smsShortCodeDAO.getListSmsShortCode();
			for (SmsShortCode mtcskh : lst) {
				System.out.println(mtcskh.getShortCode());
			}
			
			
			ReportUserTextDaily reportUserTextDaily;
			ReportUserFilter fillter=new ReportUserFilter();
			List<ReportUserVO> list=new ArrayList<ReportUserVO>();
			KPaging<ReportUserVO> paging=new KPaging<ReportUserVO> ();
			fillter.setFromDate("01/07/2014");
			fillter.setToDate("20/07/2014");
			///fillter.setServiceCode("GIALUA AG");
			paging.setPage(0);
			paging.setPageSize(20);
			//fillter.setPaging(paging);
			
			list=reportUserDAO.getReportUserTextDaily(fillter);
			System.out.println("GroupName                            ServiceCode                            TotalUser");
			for (ReportUserVO vo : list) {
				System.out.println(vo.getGroupName()+"         "+vo.getServiceCode()+"         "+vo.getTotalUser()+"         "+vo.getNewUser()+"         "+vo.getOutUser()+"         "+vo.getOutUserOther());
			}
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}	
	
	@Test
	public void getsmsShortCode() {		
		try {		
			SmsShortCode lst=smsShortCodeDAO.getSmsShortCodeById(1);
				System.out.println(lst.getShortCode());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}	
}

